/*********************************************************
          File Name:16.7.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Sat 12 Dec 2015 02:15:17 PM CST
**********************************************************/

#include <iostream>
#include <string>

using namespace std;

template<typename T, size_t N>
constexpr size_t size(T (&arr)[N])
{
        return N;
}

int main(void)
{
        int a[] = {1, 2, 3, 4, 5};
        const char aa[] = "a";
        string s[] = {"s"};

        cout << size(a) << endl;
        cout << size(aa) << endl;       // including C string terminator '\0'
        cout << size(s) << endl;
}
